﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;

namespace FoundationLib.Web.Mvc
{
	internal class HtmlPrefixScope : IDisposable
	{
		private readonly TemplateInfo template;
		private readonly string previousPrefix;

		internal HtmlPrefixScope(TemplateInfo template, string prefix)
		{
			this.template = template;
			this.previousPrefix = template.HtmlFieldPrefix;
			template.HtmlFieldPrefix = prefix;
		}

		public void Dispose()
		{
			this.template.HtmlFieldPrefix = this.previousPrefix;
		}
	}
}
